package main


func clearStars(s string) string {
    rec := make([][]int, 26)
    for i := range rec {
        rec[i] = make([]int, 0, 10)
    }
	t := []byte(s)
    for i, c := range t {
		if byte(c) != '*' {
        	rec[c - 'a'] = append(rec[c - 'a'], i)
		} else {
			t[i] = ' '
			x := 0
			for ; x < 26 && rec[x] == nil; x++ {

			}
			if x < 26 {
				idx := rec[x][len(rec[x]) - 1]
				rec[x] = rec[x][:len(rec[x]) - 1]
				t[idx] = ' '
			}
		}
    }
	ans := ""
	for _, c := range t {
		if byte(c) != ' ' {
			ans += string(c)
		}
	}
	return ans
}